#pragma once
#include <string>
#include <fstream>
#include "JNode.h"
#include "JBaseFile.h"

class JFile : public JBaseFile
{
public:
	JFile(std::string _fileName);
	JFile(void);
	~JFile(void);
	static bool IsExist(std::string fullFileName);
	static void CreateFile(std::string fileName);
	static int FileSize(std::string _fullFileName);
	std::fstream& OpenStream(std::ios_base::openmode _Mode = std::ios_base::in | std::ios_base::out);
	void CloseStream();

	//return its' self size.
	int Serialize(std::iostream& strea,int& allSize);
	void ReSerialize(std::iostream& _strea);
        static void SaveToFileName(std::iostream& _strea,std::string _fullFileName);
        
        int  ServerSerialize(std::iostream& _strea,int& allSize);
        void ServerReSerialize(std::iostream& _strea);
        
        
        
        //Serialize begin.
	std::fstream fs;
	//Serialize end.
private:

};
